﻿namespace WMS6.Services
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.ServiceModel;
    using System.ServiceModel.Activation;
    using WMS6.BLL;
    using WMS6.Common;
    using WMS6.DataEntity;
    using WMS6.QueryEntity;

    [ServiceBehavior(InstanceContextMode=InstanceContextMode.PerCall), AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
    public class OutboundService : IOutboundService
    {
        public string AutoAllocate(List<string> orderIDS, string updatedBy, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new OutboundMgtBLL(pubParasInfo).BatchAutoAllocate(orderIDS, updatedBy);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_AutoAllocate_Order", orderIDS, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string AutoPreAllocate(string orderID, string updateBy, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new OutboundMgtBLL(pubParasInfo).AutoPreAllocate(orderID, updateBy);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_AutoPreAllocate_Order", orderID, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string AutoRevertAllocate(string orderID, string updatedBy, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OutboundMgtBLL(pubParasInfo).AutoRevertAllocate(orderID, updatedBy);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_AutoRevertAllocate_Order", orderID, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string AutoRevertPreAllocate(string orderID, string updatedBy, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OutboundMgtBLL(pubParasInfo).AutoRevertPreAllocate(orderID, updatedBy);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_AutoRevertPreAllocate_Order", orderID, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string BatchAllocate(string orderID, List<string> orderLineIDS, string updatedBy, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new OutboundMgtBLL(pubParasInfo).BatchAllocate(orderID, orderLineIDS, updatedBy);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_BatchAllocate_OrderDetail", orderID, orderLineIDS, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string BatchClosed(List<string> waveID, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new WaveBLL(pubParasInfo).BatchClosed(waveID);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_Batch_Closed", waveID, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public void BatchConfirmPicked(string waveID, PubParasInfo pubParasInfo)
        {
            try
            {
                new WaveBLL(pubParasInfo).BatchConfirmPicked(waveID);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_BatchConfirmPicked", waveID, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
        }

        public string BatchOrderActions(string batchOrderID, string batchOrderType, string updatedBy, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OutboundMgtBLL(pubParasInfo).BatchOrderActions(batchOrderID, batchOrderType, updatedBy);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_Action_Wave", batchOrderID, batchOrderType, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string BatchPreAllocate(string orderID, List<string> orderLineIDs, string updateBy, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new OutboundMgtBLL(pubParasInfo).BatchPreAllocate(orderID, orderLineIDs, updateBy);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_BatchPreAllocate_OrderDetail", orderID, orderLineIDs, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public void BatchShipping(string waveID, PubParasInfo pubParasInfo)
        {
            try
            {
                new WaveBLL(pubParasInfo).BatchShipping(waveID);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_BatchShipping", waveID, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
        }

        public string CancelShipping(List<string> pickDetailID, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                CommonMethodBLL commonMethodBll = new CommonMethodBLL(pubParasInfo);
                List<string> pickDetailIDs = new List<string>();
                pickDetailIDs = commonMethodBll.GetOrderIDLineIDByPickDetailID(pickDetailID);
                temp = new OutboundMgtBLL(pubParasInfo).CancelShipping(pickDetailID);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_CancelShipping", pickDetailIDs, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string CancelShippingByOrderID(List<string> orderID, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OutboundMgtBLL(pubParasInfo).CancelShippingByOrderID(orderID);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_CancelShippingByOrderID", orderID, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string CancelShippingByOrderIDOrderLineID(string orderID, List<string> LineID, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OutboundMgtBLL(pubParasInfo).CancelShippingByOrderIDOrderLineID(orderID, LineID);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_CancelShippingByOrderIDOrderLineID", orderID, LineID, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string CheckExternalIDExist(string externalID, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OrdersBLL(pubParasInfo).CheckExternalIDExist(externalID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public List<InvLotLocLpnInfo> CheckLocationQty4Allocation(ManualAllocateParams manualAllocateParams, PubParasInfo pubParasInfo)
        {
            try
            {
                OutboundMgtBLL outboundMgtBll = new OutboundMgtBLL(pubParasInfo);
                return outboundMgtBll.CheckLocationQty4Allocation(manualAllocateParams);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return null;
        }

        public string CheckSkuIDExist(string orderID, string skuID, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OrderDetailBLL(pubParasInfo).CheckSkuIDExist(orderID, skuID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string ClosedByOrderID(List<string> orderID, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OutboundMgtBLL(pubParasInfo).ClosedByOrderID(orderID);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_Closed_By_OrderID", orderID, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string ConfirmPicked(List<string> pickDetailID, List<string> toLoc, string updateBy, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                CommonMethodBLL commonMethodBll = new CommonMethodBLL(pubParasInfo);
                List<string> pickDetailIDs = new List<string>();
                pickDetailIDs = commonMethodBll.GetOrderIDLineIDByPickDetailID(pickDetailID);
                returnStr = new OutboundMgtBLL(pubParasInfo).ConfirmPicked(pickDetailID, toLoc, updateBy);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_ConfirmPicked_OrderDetail", pickDetailIDs, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string ConfirmShipped(List<string> pickDetailID, string updateBy, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                CommonMethodBLL commonMethodBll = new CommonMethodBLL(pubParasInfo);
                List<string> pickDetailIDs = new List<string>();
                pickDetailIDs = commonMethodBll.GetOrderIDLineIDByPickDetailID(pickDetailID);
                returnStr = new OutboundMgtBLL(pubParasInfo).ConfirmShipped(pickDetailID, "", updateBy);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_ConfirmShipped_OrderDetail", pickDetailIDs, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string CreateOwnerTransferbyOrderIdLineID(string orderID, List<string> lineID, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OrderDetailBLL(pubParasInfo).CreateOwnerTransferbyOrderIdLineID(orderID, lineID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string DeleteOrderDetail(List<string> orderIDs, List<string> lineIDs, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OrderDetailBLL(pubParasInfo).DeleteDetail(orderIDs, lineIDs);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_Delete_OrderDetail", orderIDs, lineIDs, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string DeleteOrderSelectionInfos(List<string> orderSelectionID, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new OrderSelectionBLL(pubParasInfo).Delete(orderSelectionID);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_Delete_OrderSelection", orderSelectionID, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string DeleteOrdersInfos(List<string> ordersID, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new OrdersBLL(pubParasInfo).DeleteOrders(ordersID);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_Delete_Orders", ordersID, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string DeleteShipmentContainer(List<string> shipmentContainerID, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new ShipmentContainerBLL(pubParasInfo).DeleteShipmentContainer(shipmentContainerID);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_DeleteShipmentContainer", shipmentContainerID, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string DeleteWave(List<string> IDS, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new WaveBLL(pubParasInfo).DeleteWave(IDS);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_Delete_Wave", IDS, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string DirectAllocation(string orderID, List<string> orderLineIDS, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OutboundMgtBLL(pubParasInfo).DirectAllocation(orderID, orderLineIDS);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_DirectAllocation", orderID, orderLineIDS, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string EncaseNesting(string strFromContainerID, string strToContainerID, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OutboundMgtBLL(pubParasInfo).EncaseNesting(strFromContainerID, strToContainerID);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_EncaseNesting", strFromContainerID, strToContainerID, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string ExecuteExploding(List<string> orderIDs, List<string> lineIDs, PubParasInfo pubParasInfo)
        {
            string StrValue = "";
            try
            {
                StrValue = new OutboundMgtBLL(pubParasInfo).ExecuteExploding(orderIDs, lineIDs);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_Execute_Exploding", orderIDs, lineIDs, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return StrValue;
        }

        public DataSet GetAllIntransit(PubParasInfo pubParasInfo)
        {
            try
            {
                IntransitBLL intransitBll = new IntransitBLL(pubParasInfo);
                return intransitBll.GetAllIntransit();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return null;
        }

        public DataSet GetIntransitByQueryEntity(IntransitQueryEntity intransitQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                IntransitBLL intransitBll = new IntransitBLL(pubParasInfo);
                return intransitBll.GetIntransitInfoByQueryEntity(intransitQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return null;
        }

        public IntransitInfo GetIntransitInfoByID(string IntransitID, string srcDbID, PubParasInfo pubParasInfo)
        {
            IntransitInfo intransitInfo = new IntransitInfo();
            try
            {
                IntransitBLL intransitBll = new IntransitBLL(pubParasInfo);
                return intransitBll.GetIntransitInfoByID(IntransitID, srcDbID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return intransitInfo;
        }

        public string GetOrderIDsByWaveID(string waveID, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new WaveBLL(pubParasInfo).GetOrderIDsByWaveID(waveID, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public DataSet GetOrdersByOrderSelection(OrderSelectionInfo OrderSelection, PubParasInfo pubParasInfo)
        {
            try
            {
                WaveBLL waveBLL = new WaveBLL(pubParasInfo);
                return waveBLL.GetOrdersByOrderSelection(OrderSelection);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return null;
        }

        public DataSet GetOrdersByQueryEntity(OrdersQueryEntity ordersQueryEntity, PubParasInfo pubParasInfo)
        {
            try
            {
                OrdersBLL ordersBll = new OrdersBLL(pubParasInfo);
                return ordersBll.GetOrdersByQueryEntity(ordersQueryEntity);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return null;
        }

        public DataSet GetOrderSelectionAllInfo(PubParasInfo pubParasInfo)
        {
            try
            {
                OrderSelectionBLL orderSelectionBll = new OrderSelectionBLL(pubParasInfo);
                return orderSelectionBll.GetAllInfo();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return null;
        }

        public OrderSelectionInfo GetOrderSelectionByID(string OrderSelectionID, PubParasInfo pubParasInfo)
        {
            OrderSelectionInfo orderSelectionInfo = new OrderSelectionInfo();
            try
            {
                OrderSelectionBLL orderSelectionBll = new OrderSelectionBLL(pubParasInfo);
                return (orderSelectionBll.GetInfoByID(OrderSelectionID) as OrderSelectionInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return orderSelectionInfo;
        }

        public DataSet GetOrderSelectionByQueryEntity(OrderSelectionQueryEntity OrderSelectionQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                OrderSelectionBLL orderSelectionBll = new OrderSelectionBLL(pubParasInfo);
                return orderSelectionBll.GetInfoByQueryEntity(OrderSelectionQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return null;
        }

        public OrdersInfo GetOrdersInfoAndDetailListByID(string orderID, string ContainerID, PubParasInfo pubParasInfo)
        {
            OrdersInfo ordersInfo = new OrdersInfo();
            try
            {
                OrdersBLL ordersBll = new OrdersBLL(pubParasInfo);
                return ordersBll.GetOrdersInfoAndDetailListByID(orderID, ContainerID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return ordersInfo;
        }

        public OrdersInfo GetOrdersInfoByID(string orderID, PubParasInfo pubParasInfo)
        {
            OrdersInfo ordersInfo = new OrdersInfo();
            try
            {
                OrdersBLL ordersBll = new OrdersBLL(pubParasInfo);
                return ordersBll.GetOrdersInfoByID(orderID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return ordersInfo;
        }

        public OrdersInfo GetOrdersInfoByQueryEntity(OrderDetailQueryEntity orderDetailQueryEntity, PubParasInfo pubParasInfo)
        {
            OrdersInfo ordersInfo = new OrdersInfo();
            try
            {
                ordersInfo = new OrdersBLL(pubParasInfo).GetOrdersInfoByQueryEntity(orderDetailQueryEntity);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return ordersInfo;
        }

        public DataSet GetPickDetailInfoByQueryEntity(PickDetailQueryEntity pickDetailQueryEntity, PubParasInfo pubParasInfo)
        {
            try
            {
                PickDetailBLL pickDetailBll = new PickDetailBLL(pubParasInfo);
                return pickDetailBll.GetPickDetailInfoByQueryEntity(pickDetailQueryEntity);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return null;
        }

        public ShipmentContainerInfo GetShipmentContainerByID(string shipmentcontainerID, string orderID, PubParasInfo pubParasInfo)
        {
            ShipmentContainerInfo shipmentContainer = null;
            try
            {
                shipmentContainer = new ShipmentContainerBLL(pubParasInfo).GetShipmentContainerByID(shipmentcontainerID, orderID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return shipmentContainer;
        }

        public List<ShipmentContainerInfo> GetShipmentContainerByOrderID(string OrderID, PubParasInfo pubParasInfo)
        {
            List<ShipmentContainerInfo> shipmentContainer = null;
            try
            {
                shipmentContainer = new ShipmentContainerBLL(pubParasInfo).GetShipmentContainerByOrderID(OrderID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return shipmentContainer;
        }

        public OrderDetailInfo GetShippingOrderDetailByID(string OrderID, string LineID, PubParasInfo pubParasInfo)
        {
            OrderDetailInfo orderDetail = new OrderDetailInfo();
            try
            {
                OrderDetailBLL orderDetailBll = new OrderDetailBLL(pubParasInfo);
                return orderDetailBll.GetOrderDetailByID(OrderID, LineID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return orderDetail;
        }

        public List<OrdersInfo> GetShippingReviewByOrderID(string orderID, string ShippingReviewType, PubParasInfo pubParasInfo)
        {
            try
            {
                OrdersBLL ordersBLL = new OrdersBLL(pubParasInfo);
                return ordersBLL.GetShippingReviewByOrderID(orderID, ShippingReviewType);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return null;
        }

        public OrdersInfo GetShippingWeightByOrderID(string orderID, PubParasInfo pubParasInfo)
        {
            OrdersInfo ordersInfo = new OrdersInfo();
            try
            {
                OrdersBLL ordersBll = new OrdersBLL(pubParasInfo);
                return ordersBll.GetShippingWeightByOrderID(orderID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return ordersInfo;
        }

        public WaveInfo GetWaveByID(string id, PubParasInfo pubParasInfo)
        {
            WaveInfo waveInfo = new WaveInfo();
            try
            {
                WaveBLL waveBLL = new WaveBLL(pubParasInfo);
                return waveBLL.GetWaveByID(id);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return waveInfo;
        }

        public DataSet GetWaveByQueryList(WaveQueryEntity waveQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                WaveBLL waveBLL = new WaveBLL(pubParasInfo);
                return waveBLL.GetWaveByQueryList(waveQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return null;
        }

        public string InsertOrderDetailInfo(OrderDetailInfo ordersDetailInfo, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new OrderDetailBLL(pubParasInfo).InsertOrderDetail(ordersDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_Insert_OrderDetail", ordersDetailInfo, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string InsertOrderSelectionInfo(OrderSelectionInfo orderSelectionInfo, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new OrderSelectionBLL(pubParasInfo).Insert(orderSelectionInfo);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_Insert_OrderSelection", orderSelectionInfo, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string InsertOrdersInfo(OrdersInfo ordersInfo, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new OrdersBLL(pubParasInfo).InsertOrders(ordersInfo);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_Insert_Orders", ordersInfo, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string InsertShipmentContainer(List<ShipmentContainerInfo> shipmentcontainerInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new ShipmentContainerBLL(pubParasInfo).InsertShipmentContainer(shipmentcontainerInfo);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_InsertShipmentContainer", shipmentcontainerInfo, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string InsertWave(WaveInfo obj, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new WaveBLL(pubParasInfo).InsertWave(obj);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_Insert_Wave", obj, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string ManualAllocate(List<PickDetailInfo> pickDetailInfo, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new OutboundMgtBLL(pubParasInfo).ManualAllocate(pickDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_ManualAllocate_OrderDetail", pickDetailInfo, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string ReleasePcTasks(List<string> RequestID, string updateBy, string PcStatus, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OutboundMgtBLL(pubParasInfo).ReleasePcTasks(RequestID, updateBy, PcStatus);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_ReleasePcTasks", RequestID, PcStatus, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string ReleasePickTasks(List<string> pickDetailID, string updateBy, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                CommonMethodBLL commonMethodBll = new CommonMethodBLL(pubParasInfo);
                List<string> pickDetailIDs = new List<string>();
                pickDetailIDs = commonMethodBll.GetOrderIDLineIDByPickDetailID(pickDetailID);
                returnStr = new OutboundMgtBLL(pubParasInfo).ReleasePickTasks(pickDetailID, updateBy);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_ReleasePickTasks_OrderDetail", pickDetailIDs, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string RevertAllocate(List<string> pickDetailIDs, string updatedBy, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                CommonMethodBLL commonMethodBll = new CommonMethodBLL(pubParasInfo);
                List<string> PickDetailID = new List<string>();
                PickDetailID = commonMethodBll.GetOrderIDLineIDByPickDetailID(pickDetailIDs);
                temp = new OutboundMgtBLL(pubParasInfo).RevertAllocate(pickDetailIDs, updatedBy);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_RevertAllocate_Order", PickDetailID, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string RevertPicked(List<string> pickDetailID, string updateBy, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                CommonMethodBLL commonMethodBll = new CommonMethodBLL(pubParasInfo);
                List<string> pickDetailIDs = new List<string>();
                pickDetailIDs = commonMethodBll.GetOrderIDLineIDByPickDetailID(pickDetailID);
                returnStr = new OutboundMgtBLL(pubParasInfo).RevertPicked(pickDetailID, updateBy);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_RevertPicked_OrderDetail", pickDetailIDs, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string RevertPickedAllocated(List<string> pickDetailID, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                CommonMethodBLL commonMethodBll = new CommonMethodBLL(pubParasInfo);
                List<string> pickDetailIDs = new List<string>();
                pickDetailIDs = commonMethodBll.GetOrderIDLineIDByPickDetailID(pickDetailID);
                returnStr = new OutboundMgtBLL(pubParasInfo).RevertPickedAllocated(pickDetailID);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_RevertPicked_OrderDetail", pickDetailIDs, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string RevertPreAllocate(string orderID, List<string> lineIDs, string updatedBy, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OutboundMgtBLL(pubParasInfo).RevertPreAllocate(orderID, lineIDs, updatedBy);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_RevertPreAllocate_Order", orderID, lineIDs, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string ScanShipmentContainer(List<ShipmentContainerInfo> shipmentcontainerList, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new ShipmentContainerBLL(pubParasInfo).ScanShipmentContainer(shipmentcontainerList);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_ScanShipmentContainer", shipmentcontainerList, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string ShippedByOrderID(List<string> orderID, string shippDate, string updatedBy, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OutboundMgtBLL(pubParasInfo).ShippedByOrderID(orderID, shippDate, updatedBy);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_ShippedByOrderID_Order", orderID, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string ShippedByOrderLineID(string orderID, List<string> orderLineIDs, string shippDate, string updatedBy, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OutboundMgtBLL(pubParasInfo).ShippedByOrderLineID(orderID, shippDate, orderLineIDs, updatedBy);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_ShippedByOrderLineID_Order", orderID, orderLineIDs, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string ShippingWeightCancelOrder(List<string> orderID, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OutboundMgtBLL(pubParasInfo).ShippingWeightCancelOrder(orderID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string UpateActualShipDateByOrderID(string OrderID, string actualShipDate, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OutboundMgtBLL(pubParasInfo).UpateActualShipDateByOrderID(OrderID, actualShipDate);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_UpdateActualShipDateByOrderID", OrderID, actualShipDate, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string UpateActualShipDateByOrderIDLineID(string OrderID, List<string> LineID, string actualShipDate, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OutboundMgtBLL(pubParasInfo).UpateActualShipDateByOrderID(OrderID, LineID, actualShipDate);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_UpdateActualShipDateByOrderIDLineID", OrderID, LineID, actualShipDate, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string UpateActualShipDateByPickDetailID(List<string> pickDetailID, List<string> OrderID, List<string> LineID, string actualShipDate, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OutboundMgtBLL(pubParasInfo).UpateActualShipDateByPickDetailID(pickDetailID, OrderID, LineID, actualShipDate);
                for (int i = 0; pickDetailID.Count > i; i++)
                {
                    new OperationLogBLL(pubParasInfo).Insert("OutboundService_UpdateActualShipDateByPickDetailID", pickDetailID[i], actualShipDate, pubParasInfo);
                }
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string UpdateOrderDetailInfo(OrderDetailInfo ordersDetailInfo, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new OrderDetailBLL(pubParasInfo).UpdateOrderDetail(ordersDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_Update_OrderDetail", ordersDetailInfo, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string UpdateOrdersByShippingWeight(OrdersInfo ordersInfo, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new OrdersBLL(pubParasInfo).UpdateOrdersByShippingWeight(ordersInfo);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_Update_Order", ordersInfo, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string UpdateOrderSelectionInfo(OrderSelectionInfo orderSelectionInfo, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new OrderSelectionBLL(pubParasInfo).Update(orderSelectionInfo);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_Update_OrderSelection", orderSelectionInfo, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string UpdateOrdersInfo(OrdersInfo ordersInfo, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new OrdersBLL(pubParasInfo).UpdateOrdres(ordersInfo);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_Update_Orders", ordersInfo, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string UpdateOrdersIsCancel(string orderid, string isCancel, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new OrdersBLL(pubParasInfo).UpdateOrdersIsCancel(orderid, isCancel);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string UpdateOrdersPackingType(List<string> orderID, string packingType, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OrdersBLL(pubParasInfo).UpdateOrdersPackingType(orderID, packingType);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string UpdateShipmentContainer(List<ShipmentContainerInfo> shipmentcontainerList, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new ShipmentContainerBLL(pubParasInfo).UpdateShipmentContainer(shipmentcontainerList);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_UpdateShipmentContainer", shipmentcontainerList, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string UpdateShippUDFByOrderID(List<OrderDetailInfo> orderDetailInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new OutboundMgtBLL(pubParasInfo).UpdateShippUDFByOrderID(orderDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_UpdateShippUDF", orderDetailInfo, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return temp;
        }

        public string UpdateWave(WaveInfo obj, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new WaveBLL(pubParasInfo).UpdateWave(obj);
                new OperationLogBLL(pubParasInfo).Insert("OutboundService_Update_Wave", obj, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }
    }
}

